Skip to content

Laser Update#785

Open
josuenos wants to merge 2 commits intoBrettRyland:devfrom
josuenos:dev
Open

Laser Update#785
josuenos wants to merge 2 commits intoBrettRyland:devfrom
josuenos:dev

Conversation

@josuenos
Copy link

  • Lasers now do less damage over distance based on atmospheric and water attenuation. LASER_ATM_GAMMA and LASER_WATER_GAMMA in the settings.cfg control this relationship. Drop-off is given by exp(-GAMMA * DISTANCE * NORMALIZED_ATM_DENSITY), NORMALIZED_ATM_DENSITY is 1 for water transmission. At sea level, lasers will do more damage before 2.5 km, and less damage past 2.5 km. Underwater, lasers will not work past ~10m. In vacuum, lasers will do more damage than previously and be unaffected by attenuation.
  • New realism-based formula for microwave damage (lasers with conicAoE = true) based on Friis transmission equation with conical directivity gain based on tanAngle value. Microwave damage is unaffected by atmosphere, but drops off very fast with distance. Microwaves are extremely strong at short ranges.
  • Apply tanAngle and distance attenuation to electro-lasers, heat rays, and HE pulse lasers.
  • Add laser configuration options to ABL.cfg part file for reference.

…ter attenuation. LASER_ATM_GAMMA and LASER_WATER_GAMMA in the settings.cfg control this relationship. Drop-off is given by exp(-GAMMA * DISTANCE * NORMALIZED_ATM_DENSITY), NORMALIZED_ATM_DENSITY is 1 for water transmission. At sea level, lasers will do more damage before 2.5 km, and less damage past 2.5 km. Underwater, lasers will not work past ~10m. In vacuum, lasers will do more damage than previously and be unaffected by attenuation.

- New realism-based formula for microwave damage (lasers with conicAoE = true) based on Friis transmission equation with conical directivity gain based on tanAngle value. Microwave damage is unaffected by atmosphere, but drops off very fast with distance. Microwaves are extremely strong at short ranges.
- Apply tanAngle and distance attenuation to electro-lasers, heat rays, and HE pulse lasers.
- Add laser configuration options to ABL.cfg part file for reference.
// HEpulses = false // Do the pulses have blast damage
// HeatRay = false // Laser heats parts instead of doing damage
// electroLaser = false // Drains EC from target/induces EMP effects
// conicAoE = false // Is a Microwave Emitter or similar that does a conical AoE instead of a linear beam, use microwave damage formula (laserDamage * Directivity * lamda / (4 * pi * distance)^2), lambda = 0.125m (2.4 GHz)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this can be correct. The base laser damage is essentially the damage at point blank range, which should already take into account the gain (e.g., base damage ∝ Pt*Gt, where gain is G=ηD), so directivity shouldn't be an extra factor here, otherwise a non-divergent beam would transmit infinite power.
(I think the definition of gain here actually breaks down when the directivity is so high compared to the base beam width since the only way to avoid the gain going to infinity for a constant power input and constant radiation efficiency is if the beam width narrows to 0.)

However, without this factor, the formula at https://en.wikipedia.org/wiki/Friis_transmission_equation#Contemporary_formula becomes damage = base damage * Gr² * (λ/4πd)², and since the article also states that the condition d >> λ is required (and presumably Gr=1 since the target isn't a receiving antenna), then that factor is miniscule.

float normDensity = underwater ? 1f : Mathf.Max(0f, atmDensity / 1.225f);
float transmission = Mathf.Exp(-gamma * distance * normDensity);
float angularSpread = tanAngle * distance; //Scales down the damage based on the increased surface area of the area being hit by the laser. Think flashlight on a wall.
return laserDamage * transmission / (1 + Mathf.PI * angularSpread * angularSpread);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned on discord, I'm not convinced that this is the right formula for the "flashlight on a wall" analogy.
I think the proper factor ought to be 1/(1+distance/baseWidth*tanAngle)². Apparently the 1/(1+π*angularSpread²) formula comes from commit 53f086d way back in 2015.

{
float wavelength = 0.124913524166667f; // 2.4 GHz wavelength, 299792458f / 2400000000
float sqrTerm = wavelength / (4 * Mathf.PI * distance);
float finalDamage = Mathf.Min(directivity * (sqrTerm * sqrTerm), 100f * baseDamage); // Clamp max damage at very short ranges, https://en.wikipedia.org/wiki/Friis_transmission_equation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, I don't think this can be correct. Either the Friis formula doesn't apply properly here (which I think is the most likely) or we haven't understood it properly.
In particular, I don't think the factor should allow finalDamage to be higher than baseDamage, which should be the damage at "point blank" range (like it is for lasers).
(The article also mentions the Friis formula having limited applicability to power beaming, particularly in that it allows more power to be received than is transmitted under certain conditions.)

Also, code-wise, you're missing a baseDamage from the first term in Min.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants